Skip to content

feat(server): report live activity and transaction conflicts (#573, first slice) - #583

Merged
MPCoreDeveloper merged 2 commits into
masterfrom
feat/573-live-activity
Dec 6, 2026
Merged

MPCoreDeveloper merged 2 commits into
masterfrom
feat/573-live-activity

Conversation

@MPCoreDeveloper

Copy link
Copy Markdown
Owner

First slice of #573 (Operate: active queries, blocked sessions, lock waits), verified against the code first — the server had only health + Prometheus counters and no active-query tracking.nnAddedn- ManagementActivityRegistry(in-memory, bounded, lossy): active queries (session, database, user, 160-char single-line SQL preview, started/elapsed) and transaction conflicts (a session refusedBeginTransaction while another holds the database storage transaction, holder named when identifiable). An entry exists only while the call executes; conflict queue keeps the last 50.n- GET /api/v1/management/activity (admin only) — documented in REST_API under Management: live activity.n- Recorded on the real paths: DatabaseService.ExecuteQuery(scope disposed with the call) and theBeginTransaction FailedPrecondition branch.nn**Deliberately not in this slice (so #573 stays open)**n- No gRPC RPC for the snapshot (a proto change plus a capability-contract entry).n- ExecuteNonQuery and the REST query paths are not instrumented yet.n- No durable history (that is #576) and no per-query plan/lock introspection — one storage transaction per database means a "lock wait" is a transaction conflict; no invented queue positions.nnTests: ManagementActivityTests (6 cases). Server suite 307/0 locally.

…irst slice)

Operate could show health and Prometheus counters but not what the server is executing. Adds ManagementActivityRegistry (bounded, in-memory: active queries with session/database/user/160-char single-line SQL preview/elapsed, plus transaction conflicts with the holder named when identifiable), records the gRPC query path and the BeginTransaction FailedPrecondition branch, and exposes GET /api/v1/management/activity (admin only). Honest scope: no gRPC RPC yet, ExecuteNonQuery and the REST query paths are not instrumented, no durable history; the engine has one storage transaction per database so a lock wait IS a transaction conflict, and nothing invents queue positions. Docs: CHANGELOG, REST_API (Management: live activity), FEATURE_MATRIX. Tests: ManagementActivityTests (6), server suite 307/0.
@codecov

codecov Bot commented Dec 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…ity snapshot (#573)

The first slice only covered the gRPC ExecuteQuery path, so a write or a REST query never showed up in activeQueries. ExecuteNonQuery (gRPC), POST /api/v1/query and POST /api/v1/execute now open the same scope around the engine call, disposed with the request. CHANGELOG updated: the slice now covers reads and writes on both protocols; only the gRPC RPC for the snapshot itself remains out. Server suite 307/0.
@sonarqubecloud

sonarqubecloud Bot commented Dec 6, 2026

Copy link
Copy Markdown

@MPCoreDeveloper
MPCoreDeveloper merged commit 6fc8b93 into master Dec 6, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant